package com.party.mobile.web.dto.crowdfund.output;

import com.alibaba.fastjson.annotation.JSONField;
import com.party.core.model.activity.Activity;
import org.springframework.beans.BeanUtils;

/**
 * 众筹
 * Created by wei.li
 *
 * @date 2017/3/1 0001
 * @time 10:30
 */
public class TargetHomeOutput extends TargetOutput {

    //是否显示在主页
    @JSONField(name = "isHome")
    private boolean isHome;

    //价格
    private Float price;

    public boolean isHome() {
        return isHome;
    }

    public void setHome(boolean home) {
        isHome = home;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }


    public static TargetHomeOutput transform(Activity activity){
        TargetHomeOutput targetHomeOutput = new TargetHomeOutput();
        BeanUtils.copyProperties(activity, targetHomeOutput);
        targetHomeOutput.setCrowdfundNum(activity.getBeCrowdfundNum() + activity.getCrowdfundedNum());
        return targetHomeOutput;
    }
}
